<html>
<head><meta charset="utf-8"><title>Statically disallowing oom panics · t-libs/wg-allocators · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/index.html">t-libs/wg-allocators</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Statically.20disallowing.20oom.20panics.html">Statically disallowing oom panics</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="234596641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Statically%20disallowing%20oom%20panics/near/234596641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Ericson <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Statically.20disallowing.20oom.20panics.html#234596641">(Apr 15 2021 at 00:12)</a>:</h4>
<p>Linus's response in <a href="https://lore.kernel.org/lkml/CAHk-=wh_sNLoz84AUUzuqXEsYH35u=8HV3vK-jbRbJ_B-JjGrg@mail.gmail.com/">https://lore.kernel.org/lkml/CAHk-=wh_sNLoz84AUUzuqXEsYH35u=8HV3vK-jbRbJ_B-JjGrg@mail.gmail.com/</a> I can't say surprises me. I would love to have a cargo feature to get rid of anything related to panicking in <code>alloc</code> to definitively put this to rest without breaking comparability with the rest of the ecosystem completely.</p>



<a name="234954929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Statically%20disallowing%20oom%20panics/near/234954929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Ericson <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Statically.20disallowing.20oom.20panics.html#234954929">(Apr 17 2021 at 03:14)</a>:</h4>
<p>I have PR for this <a href="https://github.com/rust-lang/rust/pull/84266">https://github.com/rust-lang/rust/pull/84266</a> . It seems to build OK except for a mysterious usage of <code>exchange_malloc</code>.</p>



<a name="234956470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Statically%20disallowing%20oom%20panics/near/234956470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Ericson <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Statically.20disallowing.20oom.20panics.html#234956470">(Apr 17 2021 at 03:43)</a>:</h4>
<p>I also made a WG issue with <a href="https://github.com/rust-lang/wg-allocators/issues/87">https://github.com/rust-lang/wg-allocators/issues/87</a></p>



<a name="235733588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Statically%20disallowing%20oom%20panics/near/235733588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Ericson <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Statically.20disallowing.20oom.20panics.html#235733588">(Apr 22 2021 at 19:22)</a>:</h4>
<p><a href="#narrow/stream/219381-t-libs/topic/alloc.20non-global-oom.20support">https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/alloc.20non-global-oom.20support</a> effectively supercedes this.</p>



<a name="240021873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Statically%20disallowing%20oom%20panics/near/240021873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tim Diekmann <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Statically.20disallowing.20oom.20panics.html#240021873">(May 24 2021 at 08:39)</a>:</h4>
<blockquote>
<p>For this first iteration, non-flat collections are outright disabled. <code>Vec</code> and <code>String</code> don't yet have <code>try_*</code> allocation methods, but are kept anyways since they can be oom-safely created "from parts", and we hope to add those <code>try_</code> methods in the future.</p>
</blockquote>
<p>Is there a specific reason, why they are not added besides "no one did it"?</p>



<a name="240022198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Statically%20disallowing%20oom%20panics/near/240022198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tim Diekmann <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Statically.20disallowing.20oom.20panics.html#240022198">(May 24 2021 at 08:43)</a>:</h4>
<p>Also, in case you unsubscribe from merged PRs, is there a specific reason, why <code>Arc::new</code> and <code>Rc::new</code> were not gated? They internally use the <code>box</code> syntax and occured in <a href="https://github.com/rust-lang/rust/issues/84338">#84338</a>. I'd just add those gates there. This also implies adding gates to <code>(A)Rc::{pin, default}</code> as they are using <code>new</code> internally.</p>



<a name="242293508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Statically%20disallowing%20oom%20panics/near/242293508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Ericson <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Statically.20disallowing.20oom.20panics.html#242293508">(Jun 11 2021 at 02:11)</a>:</h4>
<p><span class="user-mention" data-user-id="216785">@Tim Diekmann</span> Sorry, had the notification just missed it. That was indeed an oversight on my part.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>